import java.util.Arrays;

public class selectsort {
   public static int countt = 0;
    public static void select(int[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            int count = i;
            int min = arr[i];
            for (int j = i + 1; j < arr.length; j++) {
                if (min>arr[j]){
                    min = arr[j];
                    count = j;
                }
                countt++;
            }
            if (count!=i){
                arr[count] = arr[i];
                arr[i] = min;
            }
        }
    }

    public static void main(String[] args) {
        int[] arr = {10,-1,12,2,3,14};
        select(arr);
        System.out.println(Arrays.toString(arr));
        System.out.println(countt);
    }
}
